import request from "./request"

const key = "afd9088189a2b991a338a1543f49f8ec"

// 通过 ip 地址查询
export const getCity = () => {
  return request({
    url: `/ip?key=${key}`,
    method: "get",
  })
}

// 通过城市名查询adcode接口
export const getAdcode = (city) => {
  return request({
    url: `/geocode/geo?address=${city}&key=${key}`,
    method: "get",
  })
}

// 根据adcode访问指定城市的当日天气
export const getWeatherToday = (adcode) => {
  return request({
    url: `/weather/weatherInfo?city=${adcode}&key=${key}&extensions=base`,
    method: "get",
  })
}

// 根据adcode访问指定城市的未来天气
export const getWeatherFuture = (adcode) => {
  return request({
    url: `/weather/weatherInfo?city=${adcode}&key=${key}&extensions=all`,
    method: "get",
  })
}
